package payroll.trans;

import payroll.Employee;
import payroll.PayrollDatabase;
import payroll.Transaction;
import payroll.exception.NoSuchEmployeeException;

public abstract class ChangeEmployeeTransaction {

	protected int empId;

	protected abstract void doChange(Employee e);


	public ChangeEmployeeTransaction(int empId) {
		this.empId=empId;
	}

	public void execute() {
		Employee e = PayrollDatabase.getEmployee(empId);
		if (e != null) {
			doChange(e);
		} else {
			throw new NoSuchEmployeeException();
		}
	
	}
	
}